//
//  HWAccountSecurityController.m
//  HWanGame
//
//  Created by 陈道斌 on 2019/10/28.
//  Copyright © 2019 Chendaobin. All rights reserved.
//

#import "HWAccountSecurityController.h"
#import "HWAccountSecurityCell.h"
#import "HWRealNameAuthenticationController.h"
#import "HWBindingQQViewController.h"
#import "HWAssociatedPhoneViewController.h"
#import "HWMobilePhoneDianhHuaViewController.h"
#import "HWXiuGaiEmailViewController.h" // 邮箱验证
#import "HWVerificationViewController.h"
#import "HWAccountSecurityModel.h" // 本试图模型

#import "HWGuanLianEmailViewController.h" // 绑定邮箱

#import "HWXiuGaiMimaJiemianViewController.h" // 修改密码接口  知道密码时候
#import "HWMobilePhoneDianhHuaViewController.h" // 手机号解绑
#import "HWXiuGaiEmailViewController.h"  // 邮箱解绑


#import  "HWZhangHaokonghziView.h"

#import "HWzhanghaoTableViewCell.h"


@interface HWAccountSecurityController ()<UITableViewDataSource,UITableViewDelegate>
@property(strong,nonatomic) UITableView *mainaTableVie;
@property(strong,nonatomic) UIView *headerView;
@property(strong,nonatomic) UILabel *fenshuLabel;
@property(strong,nonatomic) UILabel *zhanghuaanqunLabel;
@property(strong,nonatomic) UILabel *pointsLabel;

@property(strong,nonatomic) NSArray *rightArr;
@property(strong,nonatomic) NSMutableArray *dataMuArr;
@property(strong,nonatomic) NSString *emailStr;
@property(strong,nonatomic) NSString *phoneStr;

@property(strong,nonatomic) HWZhangHaokonghziView *zhanghaoView;
@property(strong,nonatomic) NSDictionary *zongshujuDic;
 




@end

@implementation HWAccountSecurityController

-(UITableView *)mainaTableVie {

    if  (_mainaTableVie == nil) {

        _mainaTableVie = [[UITableView alloc]initWithFrame:CGRectMake(0, 0, kScreenW, kScreenH) style:UITableViewStylePlain];
        _mainaTableVie.delegate = self;
        _mainaTableVie.dataSource = self;
        _mainaTableVie.separatorStyle = UITableViewCellSeparatorStyleNone;
        
        _mainaTableVie.backgroundColor = [UIColor whiteColor];
        _mainaTableVie.backgroundColor = RGB(247, 247, 247);
        
        
        
    }
    return   _mainaTableVie ;

}

- (void)viewWillAppear:(BOOL)animated {
    
    [super viewWillAppear:animated];
     //  [self sendNetworkRequest];
    
    [self zuixingqingqiushuju];
    
    self.navigationController.navigationBarHidden = NO;
    
    
}
- (void)viewDidLoad {
    [super viewDidLoad];
    // Do any additional setup after loading the view.
    self.view.backgroundColor = [UIColor whiteColor];
    self.navigationItem.title = @"安全中心";
    
    self.navigationItem.title = [HWjianzhiduiObject keylocalization:@"安全中心"];
    
    //[self addshuju];
   //  [self setupUI];
    
  //  [self sendNetworkRequest];

    
    
    [self setUpkongjianI];
    
    
}


- (void)setUpkongjianI {
    
    
    [self.view addSubview:self.mainaTableVie];
    
    UIView *headview  = [[UIView alloc]initWithFrame:CGRectMake(0, 0, kScreenW, 140)];
    self.mainaTableVie.tableHeaderView = headview;

    self.zhanghaoView  =   [[NSBundle mainBundle]loadNibNamed:@"HWZhangHaokonghziView" owner:nil options:nil].firstObject;
     self.zhanghaoView .frame = CGRectMake(0, 0 , kScreenW, 130);
    self.zhanghaoView.backgroundColor = RGB(247, 247, 247);
    [headview addSubview: self.zhanghaoView ];
    
    
    
    
     
    
}


// 最新请求数据
- (void)zuixingqingqiushuju {
    
       NSString *userID = [HWLocallyStoredData getLoginUserID];
          NSString *tStr = [NSString stringWithFormat:@"%ld",[WMUtil getTimeSp]];
          NSString *sign = [NSString stringWithFormat:@"%@%@%@",userID,tStr,@"fsd213ewdsadqwe2121213edsad"];
          NSString *signMD5 = [WMUtil md5HexDigest:sign];
          
          
          
          
          
          NSDictionary *parametes = @{
                                      @"ct" :  @"app",
                                      @"ac" : @"anquan",
                                      @"ios" : @"1",
                                      @"uid" :userID,
                                      @"t" :tStr,
                                      @"sign": signMD5,
                                      @"language":[HWjianzhiduiObject returnLanguageAcquisition],
                                      };
          
          
      
          //[MBProgressHUD show:@"查询用户信息..."];
    
    
    [HWWebUtils do4GetWithParameters:parametes hiddenparameterStr:HW_anquan progress:nil success:^(id  _Nullable response) {
        
        
                NSString *codeStr =  [NSString stringWithFormat:@"%@",response[@"code"]];
                   //   [MBProgressHUD hideHUD];
        
        
                      if ([codeStr intValue] == 1) {
        
                          self.zongshujuDic = response[@"data"];
                          
                          self.dataMuArr = self.dataMuArr = [HWAccountSecurityModel mj_objectArrayWithKeyValuesArray:response[@"data"][@"nav"]];
                          [self shuxingshujuView];
                          [self.mainaTableVie reloadData];
                          
        
        
                      } else {
        
                           [MBProgressHUD  showError:@"查询用户信息失败"];
        
                      }
        
                      [self.mainaTableVie reloadData];
        
        
        
    } failure:^(NSString *error) {
        
           [MBProgressHUD  showError:@"查询用户信息失败"];
        
    }];
    
         
          
//          [HWWebUtils doGetWithParameters:parametes progress:nil success:^(id response) {
//
//
//              NSString *codeStr =  [NSString stringWithFormat:@"%@",response[@"code"]];
//           //   [MBProgressHUD hideHUD];
//
//
//              if ([codeStr intValue] == 1) {
//
//                    self.dataMuArr = [HWAccountSecurityModel mj_objectArrayWithKeyValuesArray:response[@"data"][@"nav"]];
//                    self.fenshuLabel.text = [NSString stringWithFormat:@"%@",response[@"data"][@"grade"]];
//                 //   [MBProgressHUD  showError:@"查询用户信息成功"];
//
//                  self.emailStr = response[@"data"][@"email"];
//                  self.phoneStr = response[@"data"][@"phone"];
//
//
//
//
//
//              } else {
//
//                   [MBProgressHUD  showError:@"查询用户信息失败"];
//
//              }
//
//              [self.mainaTableVie reloadData];
//
//              NSLog(@"%@",response);
//
//
//          } failure:^(NSString *error) {
//
//              [MBProgressHUD  showError:@"查询用户信息失败"];
//
//
//
//
//          }];
//
    
    

    
    
}




// 刷新数据
- (void)shuxingshujuView {
    
    
    self.zhanghaoView.baifenbiLabel.text  = [NSString stringWithFormat:@"%@%%",self.zongshujuDic[@"grade"]];
    
    self.zhanghaoView.dengjiLabel.text = [NSString stringWithFormat:@"%@",self.zongshujuDic[@"dengji"] ];
    
    
}























//- (void)addshuju {
//   // self.dataArr = @[@"实名认证",@"绑定QQ账号",@"设置密码",@"绑定手机号",@"绑定邮箱"];
//  //  self.rightArr = @[@"未实名",@"未绑定",@"修改密码",@"未绑定",@"未绑定"];
//
//}
//
////发送网络请求
//- (void)sendNetworkRequest {
//
//
//        NSString *userID = [HWLocallyStoredData getLoginUserID];
//        NSString *tStr = [NSString stringWithFormat:@"%ld",[WMUtil getTimeSp]];
//        NSString *sign = [NSString stringWithFormat:@"%@%@%@",userID,tStr,@"fsd213ewdsadqwe2121213edsad"];
//        NSString *signMD5 = [WMUtil md5HexDigest:sign];
//
//
//
//
//
//        NSDictionary *parametes = @{
//                                    @"ct" :  @"app",
//                                    @"ac" : @"anquan",
//                                    @"ios" : @"1",
//                                    @"uid" :userID,
//                                    @"t" :tStr,
//                                    @"sign": signMD5
//                                    };
//
//
//
//        //[MBProgressHUD show:@"查询用户信息..."];
//
//
//        [HWWebUtils doGetWithParameters:parametes progress:nil success:^(id response) {
//
//
//            NSString *codeStr =  [NSString stringWithFormat:@"%@",response[@"code"]];
//         //   [MBProgressHUD hideHUD];
//
//
//            if ([codeStr intValue] == 1) {
//
//                  self.dataMuArr = [HWAccountSecurityModel mj_objectArrayWithKeyValuesArray:response[@"data"][@"nav"]];
//                  self.fenshuLabel.text = [NSString stringWithFormat:@"%@",response[@"data"][@"grade"]];
//               //   [MBProgressHUD  showError:@"查询用户信息成功"];
//
//                self.emailStr = response[@"data"][@"email"];
//                self.phoneStr = response[@"data"][@"phone"];
//
//
//
//
//
//            } else {
//
//                 [MBProgressHUD  showError:@"查询用户信息失败"];
//
//            }
//
//            [self.mainaTableVie reloadData];
//
//            NSLog(@"%@",response);
//
//
//        } failure:^(NSString *error) {
//
//            [MBProgressHUD  showError:@"查询用户信息失败"];
//
//
//
//
//        }];
//
//
//
//
//
//
//}
//
//






//- (void)setupUI {
//
//
//    self.view.backgroundColor = [UIColor whiteColor];
//    self.navigationItem.title = @"账户安全";
//    [self.view addSubview:self.mainaTableVie];
//
//    self.headerView = [[UIView alloc]initWithFrame:CGRectMake(0, 0, kScreenW, 159)];
//    self.headerView.backgroundColor = [UIColor whiteColor];
//    self.mainaTableVie.tableHeaderView =self.headerView;
//
//    [self addHeadVer];
//
//
//
//
//}
//// 添加HederView
//- (void)addHeadVer {
//
//    UIImageView *imageView = [[UIImageView alloc]initWithFrame:CGRectMake(0, 0, kScreenW, 159)];
//  //   imageView.image = [UIImage imageNamed:@"safe_Account_bg"];
//    imageView.backgroundColor =QCchunseshensetupian;
//
//    [self.headerView addSubview:imageView];
//
//    UIImageView  *zhuaquanimage =  [[UIImageView alloc]initWithFrame:CGRectMake((kScreenW-116)/2, 21, 116, 116)];
//    zhuaquanimage.image = [UIImage imageNamed:@"p_safe_cquan"];
//    [self.headerView addSubview:zhuaquanimage];
//
//     self.fenshuLabel = [[UILabel alloc]initWithFrame:CGRectMake((116-40)/2, 39, 40, 30)];
//     self.fenshuLabel.font = [UIFont systemFontOfSize:29];
//     self.fenshuLabel.textColor = RGB(255, 255, 255);
//     self.fenshuLabel.textAlignment =  NSTextAlignmentCenter;
//    self.fenshuLabel.text = @"98";
//  //  self.fenshuLabel.backgroundColor = [UIColor redColor];
//     [zhuaquanimage addSubview:  self.fenshuLabel];
//
//
//    self.zhanghuaanqunLabel = [[UILabel alloc]initWithFrame:CGRectMake(0, self.fenshuLabel.bottom+5, 116, 12)];
//    self.zhanghuaanqunLabel.font = [UIFont systemFontOfSize:10];
//    self.zhanghuaanqunLabel.textColor = RGB(255, 255, 255);
//    self.zhanghuaanqunLabel.textAlignment =  NSTextAlignmentCenter;
//    self.zhanghuaanqunLabel.text = @"账户安全评分";
//  //  self.zhanghuaanqunLabel.backgroundColor = [UIColor redColor];
//    [zhuaquanimage addSubview:  self.zhanghuaanqunLabel];
//
//
//    self.pointsLabel = [[UILabel alloc]initWithFrame:CGRectMake(self.fenshuLabel.right-5, 35, 10, 10)];
//    self.pointsLabel.font = [UIFont systemFontOfSize:10];
//    self.pointsLabel.textColor = RGB(255, 255, 255);
//    self.pointsLabel.textAlignment =  NSTextAlignmentCenter;
//    self.pointsLabel.text = @"分";
//     //  self.zhanghuaanqunLabel.backgroundColor = [UIColor redColor];
//    [zhuaquanimage addSubview:self.pointsLabel];
//
//
//
//
//}


- (NSInteger)numberOfSectionsInTableView:(UITableView *)tableView {
    
    
    return  2;
    
}





- (NSInteger)tableView:(UITableView *)tableView numberOfRowsInSection:(NSInteger)section {
    
    
    if (section == 0 ) {
          return self.dataMuArr.count-1;
    } else if (section == 1) {
        
        return 1;
        
    }
  
    return 1;
    
    
    
}


- (UITableViewCell *)tableView:(UITableView *)tableView cellForRowAtIndexPath:(NSIndexPath *)indexPath {
    
    
    //     static NSString *cellID = @"cellID";
    //    HWAccountSecurityCell *cell = [tableView dequeueReusableCellWithIdentifier:cellID];
    //    if (!cell) {
    //        cell = [[NSBundle mainBundle]loadNibNamed:@"HWAccountSecurityCell" owner:nil options:nil].lastObject;
    //
    //    }
    //    cell.backgroundColor = [UIColor whiteColor];
    //    cell.selectionStyle  = UITableViewCellSelectionStyleNone;
    //
    //    HWAccountSecurityModel *mdel = self.dataMuArr[indexPath.row];
    //
    //    cell.nameLabel.text = mdel.name;
    //    cell.rightLabel.text = mdel.status;
        
        
    
    
    
    
    if (indexPath.section == 0) {
        
          static NSString *cellID = @"cellID";

            HWzhanghaoTableViewCell *cell = [tableView dequeueReusableCellWithIdentifier:cellID];
            if (!cell) {
                 cell = [[NSBundle mainBundle]loadNibNamed:@"HWzhanghaoTableViewCell" owner:nil options:nil].lastObject;
            }
            
            cell.contentView.backgroundColor = RGB(247, 247, 247);
             cell.selectionStyle  = UITableViewCellSelectionStyleNone;
             HWAccountSecurityModel *mdel = self.dataMuArr[indexPath.row];
            
            
            
            cell.mingchengLabel.text =mdel.name;
            
            
          //   cell.dianhuaLabel.text = [NSString stringWithFormat:@"%@",self.zongshujuDic[@"phone"]];
             
            cell.querenzhiLabel.text = mdel.status;
            
            cell.dianhuaLabel.hidden = YES;
            if ([mdel.type isEqualToString:@"3"]) {
                 cell.dianhuaLabel.hidden = NO;
                 cell.dianhuaLabel.text = [NSString stringWithFormat:@"%@",self.zongshujuDic[@"phone"]];
                
                
                
            } else if ([mdel.type isEqualToString:@"4"]) {
                
                cell.dianhuaLabel.hidden = NO;
                cell.dianhuaLabel.text = [NSString stringWithFormat:@"%@",self.zongshujuDic[@"email"]];
                               
                
                
            }
            
            [cell.icoiamgetupianInageView sd_setImageWithURL:[NSURL URLWithString:mdel.icon] placeholderImage:nil];
            
            
            return  cell;
        
        
    } else {
        
        
        static NSString *cellID = @"cellID";

                 HWzhanghaoTableViewCell *cell = [tableView dequeueReusableCellWithIdentifier:cellID];
                 if (!cell) {
                      cell = [[NSBundle mainBundle]loadNibNamed:@"HWzhanghaoTableViewCell" owner:nil options:nil].lastObject;
                 }
                 
                 cell.contentView.backgroundColor = RGB(247, 247, 247);
                  cell.selectionStyle  = UITableViewCellSelectionStyleNone;
                 HWAccountSecurityModel *mdel = self.dataMuArr.lastObject;
                 
           [cell.yanshitupianiamgeView    sd_setImageWithURL:[NSURL URLWithString: mdel.icon] placeholderImage:nil];
        
        cell.dianhuaLabel.hidden = YES;
                 cell.mingchengLabel.text = @"登录密码";
        cell.mingchengLabel.text =  [HWjianzhiduiObject keylocalization:@"登录密码"];
        
                 
          cell.yanshitupianiamgeView.hidden = NO;
        
               //   cell.dianhuaLabel.text = [NSString stringWithFormat:@"%@",self.zongshujuDic[@"phone"]];
                  
                  cell.querenzhiLabel.text = @"修改";
        cell.querenzhiLabel.text = [HWjianzhiduiObject keylocalization:@"修改"];
        
        
        return cell;
        
        
        
        
    }
    
   
    
}


- (CGFloat)tableView:(UITableView *)tableView heightForRowAtIndexPath:(NSIndexPath *)indexPath {
    
    return  62;
    
}

- (void)tableView:(UITableView *)tableView didSelectRowAtIndexPath:(NSIndexPath *)indexPath {
    
    
    
      HWAccountSecurityModel *mdel = self.dataMuArr[indexPath.row];
    
    
    if (indexPath.section == 0 ) {
        
        
        if ([mdel.type isEqualToString:@"0"]) {
             
               if ([mdel.status isEqualToString:@"去认证"]) {
             
                         HWRealNameAuthenticationController *authentication = [[HWRealNameAuthenticationController alloc]init];
                         [self.navigationController pushViewController:authentication animated:YES];
             
                     } else {
             
             
             
                     }
             
             
         } else if ([mdel.type isEqualToString:@"3"]) {
             
             
             
             
                     if ([mdel.status isEqualToString:@"去绑定"]) {
             
                         HWAssociatedPhoneViewController *associated = [[HWAssociatedPhoneViewController alloc]init];
                         [self.navigationController pushViewController:associated animated:YES];
             
             
             
                     } else {
             
                         HWMobilePhoneDianhHuaViewController *mobil = [[HWMobilePhoneDianhHuaViewController alloc]init];
                       //   mobil.phoneStr = self.phoneStr;
                          mobil.phoneStr = [NSString stringWithFormat:@"%@",self.zongshujuDic[@"phone"]];
                         [self.navigationController pushViewController:mobil animated:YES];
             
             
             
             
                     }
             
             
             
         } else if ([mdel.type isEqualToString:@"4"]) {
             
             
                     if ([mdel.status isEqualToString:@"去绑定"]) {
             
                        HWGuanLianEmailViewController *youxiang = [[HWGuanLianEmailViewController alloc]init];
                        [self.navigationController pushViewController:youxiang animated:YES];
             
             
                     } else {
             
                         HWXiuGaiEmailViewController *XiuGaiEmail = [[HWXiuGaiEmailViewController alloc]init];
                         //  XiuGaiEmail.emailStr = self.emailStr;
                           XiuGaiEmail.emailStr   =  [NSString stringWithFormat:@"%@",self.zongshujuDic[@"email"]];
                         [self.navigationController pushViewController:XiuGaiEmail animated:YES];
             
             
             
             
             
             
                     }
             
             
             
             
             
             
         }else if ([mdel.type isEqualToString:@"2"]) {
             
             
                     HWXiuGaiMimaJiemianViewController  *gaiMimaJiemian = [[HWXiuGaiMimaJiemianViewController alloc]init];
                     [self.navigationController pushViewController:gaiMimaJiemian animated:YES];
             
             
             
             
         }
         
        
        
    } else {
        
        
        HWXiuGaiMimaJiemianViewController  *gaiMimaJiemian = [[HWXiuGaiMimaJiemianViewController alloc]init];
        [self.navigationController pushViewController:gaiMimaJiemian animated:YES];
                   
                   
        
        
    }
      
 
    
    
//     if (indexPath.row == 0) {
//
//
//
//      //  return;
//        if ([mdel.status isEqualToString:@"未认证"]) {
//
//            HWRealNameAuthenticationController *authentication = [[HWRealNameAuthenticationController alloc]init];
//            [self.navigationController pushViewController:authentication animated:YES];
//
//        } else {
//
//
//
//        }
//
//
//
//
//    } else if (indexPath.row == 1) {
//
//
////        HWVerificationViewController  *verifica = [[HWVerificationViewController alloc]init];
////        [self.navigationController pushViewController:verifica animated:YES];
//
//        HWXiuGaiMimaJiemianViewController  *gaiMimaJiemian = [[HWXiuGaiMimaJiemianViewController alloc]init];
//        [self.navigationController pushViewController:gaiMimaJiemian animated:YES];
//
//       // HWVerificationViewController
//
//
//    } else if(indexPath.row == 2) {
//
//
//        if ([mdel.status isEqualToString:@"未绑定"]) {
//
//            HWAssociatedPhoneViewController *associated = [[HWAssociatedPhoneViewController alloc]init];
//            [self.navigationController pushViewController:associated animated:YES];
//
//
//
//        } else {
//
//            HWMobilePhoneDianhHuaViewController *mobil = [[HWMobilePhoneDianhHuaViewController alloc]init];
//            mobil.phoneStr = self.phoneStr;
//
//            [self.navigationController pushViewController:mobil animated:YES];
//
//
//
//
//        }
//
//
//
//
//    } else if (indexPath.row == 3) {
//
////        HWXiuGaiEmailViewController *xiugaiEmail = [[HWXiuGaiEmailViewController alloc]init];
////        [self.navigationController pushViewController:xiugaiEmail animated:YES];
//
//        if ([mdel.status isEqualToString:@"未绑定"]) {
//
//           HWGuanLianEmailViewController *youxiang = [[HWGuanLianEmailViewController alloc]init];
//           [self.navigationController pushViewController:youxiang animated:YES];
//
//
//        } else {
//
//            HWXiuGaiEmailViewController *XiuGaiEmail = [[HWXiuGaiEmailViewController alloc]init];
//            XiuGaiEmail.emailStr = self.emailStr;
//
//            [self.navigationController pushViewController:XiuGaiEmail animated:YES];
//
//
//
//
//
//
//        }
//
//    }

        
        

        
        
        
    
    
}




- (CGFloat)tableView:(UITableView *)tableView heightForHeaderInSection:(NSInteger)section
{
    
    
    return  56;
    
    return  44;
    
    
}
- (CGFloat)tableView:(UITableView *)tableView heightForFooterInSection:(NSInteger)section {
    
    return 20;
    
    
    
}


- (nullable UIView *)tableView:(UITableView *)tableView viewForHeaderInSection:(NSInteger)section {
    
    
    
    UIView  *view = [[UIView alloc]initWithFrame:CGRectMake(0, 0, kScreenW, kScreenH)];
    view.backgroundColor = RGB(247, 247, 247);
    
    
    
    UIView *baiseView = [[UIView alloc] initWithFrame:CGRectMake(20, 10, kScreenW-40, 46)];
    baiseView.backgroundColor = RGB(255, 255, 255);
    
    [view addSubview:baiseView];
    
    
        UIBezierPath *maskPath = [UIBezierPath bezierPathWithRoundedRect:baiseView.bounds byRoundingCorners:UIRectCornerTopLeft | UIRectCornerTopRight cornerRadii:CGSizeMake(10, 10)];
        CAShapeLayer *maskLayer = [[CAShapeLayer alloc] init];
        maskLayer.frame = baiseView.bounds;
        maskLayer.path = maskPath.CGPath;
        baiseView.layer.mask = maskLayer;
    
    
        UIView *view1 = [[UIView alloc] initWithFrame:CGRectMake(20, 24,4,16)];
        
        view1.backgroundColor = RGB(248, 119, 6);
    //    view1.layer.cornerRadius = 10;
    //    view1.layer.masksToBounds = YES;
    //
        [baiseView addSubview:view1];
        
    
    
    UILabel *nameLabel = [[UILabel alloc]initWithFrame:CGRectMake(view1.right+6,20, 200, 26)];
               //     nameLabel.text = fanlilistArr[i];
        //  nameLabel.backgroundColor =  RGB(248, 119, 6);
         nameLabel.backgroundColor = [UIColor clearColor];
          nameLabel.textAlignment = NSTextAlignmentLeft;
          nameLabel.font = [UIFont systemFontOfSize:18];
          nameLabel.textColor = RGB(68, 68, 68);
    
   nameLabel.text = @"账号关联";
 //    nameLabel.font = [UIFont fontWithName:@"Helvetica-BoldOblique" size:20];//又粗又斜
     //     nameLabel.layer.cornerRadius = 8;
     //     nameLabel.layer.masksToBounds = YES;
    UIFontDescriptor * fontD = [nameLabel.font.fontDescriptor
    fontDescriptorWithSymbolicTraits:UIFontDescriptorTraitBold
                    | UIFontDescriptorTraitItalic];
    nameLabel.font = [UIFont fontWithDescriptor:fontD size:0];

          nameLabel.text = @"平台活动";
       [baiseView addSubview:nameLabel];
    
    if (section == 0) {
        
        
         nameLabel.text = @"账号关联";
        nameLabel.text =  [HWjianzhiduiObject keylocalization:@"账号关联"];
        
         
        
        
    } else  {
        
        
          nameLabel.text = @"平台活动";
          nameLabel.text =  [HWjianzhiduiObject keylocalization:@"平台活动"];
        
        
    }
    

     

    
    
    return  view;
    
    
    
    
    
}


- (nullable UIView *)tableView:(UITableView *)tableView viewForFooterInSection:(NSInteger)section {
    
    
    
    
    
    UIView  *view = [[UIView alloc]initWithFrame:CGRectMake(0, 0, kScreenW, 20)];
    view.backgroundColor =RGB(247, 247, 247);
    
    
    UIView *baiseView = [[UIView alloc] initWithFrame:CGRectMake(20, 0, kScreenW-40, 20)];
      baiseView.backgroundColor = RGB(255, 255, 255);
      
      [view addSubview:baiseView];
      
      
          UIBezierPath *maskPath = [UIBezierPath bezierPathWithRoundedRect:baiseView.bounds byRoundingCorners:UIRectCornerBottomLeft | UIRectCornerBottomRight cornerRadii:CGSizeMake(10, 10)];
          CAShapeLayer *maskLayer = [[CAShapeLayer alloc] init];
          maskLayer.frame = baiseView.bounds;
          maskLayer.path = maskPath.CGPath;
          baiseView.layer.mask = maskLayer;
    
    
    
    
    return  view;
    
    
    
}

@end



#pragma mark ---------------------------  以前代码



//#import "HWAccountSecurityController.h"
//#import "HWAccountSecurityCell.h"
//#import "HWRealNameAuthenticationController.h"
//#import "HWBindingQQViewController.h"
//#import "HWAssociatedPhoneViewController.h"
//#import "HWMobilePhoneDianhHuaViewController.h"
//#import "HWXiuGaiEmailViewController.h" // 邮箱验证
//#import "HWVerificationViewController.h"
//#import "HWAccountSecurityModel.h" // 本试图模型
//
//#import "HWGuanLianEmailViewController.h" // 绑定邮箱
//
//#import "HWXiuGaiMimaJiemianViewController.h" // 修改密码接口  知道密码时候
//#import "HWMobilePhoneDianhHuaViewController.h" // 手机号解绑
//#import "HWXiuGaiEmailViewController.h"  // 邮箱解绑
//
//
//@interface HWAccountSecurityController ()<UITableViewDataSource,UITableViewDelegate>
//@property(strong,nonatomic) UITableView *mainaTableVie;
//@property(strong,nonatomic) UIView *headerView;
//@property(strong,nonatomic) UILabel *fenshuLabel;
//@property(strong,nonatomic) UILabel *zhanghuaanqunLabel;
//@property(strong,nonatomic) UILabel *pointsLabel;
//
//@property(strong,nonatomic) NSArray *rightArr;
//@property(strong,nonatomic) NSMutableArray *dataMuArr;
//@property(strong,nonatomic) NSString *emailStr;
//@property(strong,nonatomic) NSString *phoneStr;
//
//
//@end
//
//@implementation HWAccountSecurityController
//
//-(UITableView *)mainaTableVie {
//
//    if  (_mainaTableVie == nil) {
//
//        _mainaTableVie = [[UITableView alloc]initWithFrame:CGRectMake(0, 0, kScreenW, kScreenH) style:UITableViewStylePlain];
//        _mainaTableVie.delegate = self;
//        _mainaTableVie.dataSource = self;
//        _mainaTableVie.separatorStyle = UITableViewCellSeparatorStyleNone;
//
//        _mainaTableVie.backgroundColor = [UIColor whiteColor];
//       // _mainaTableVie.backgroundColor = RGB(241, 242, 244);
//
//    }
//    return   _mainaTableVie ;
//
//}
//
//- (void)viewWillAppear:(BOOL)animated {
//
//    [super viewWillAppear:animated];
//      [self sendNetworkRequest];
//
//
//
//}
//
//- (void)viewDidLoad {
//    [super viewDidLoad];
//    // Do any additional setup after loading the view.
//    [self addshuju];
//    [self setupUI];
//
//  //  [self sendNetworkRequest];
//
//
//}
//
//
//- (void)addshuju {
//   // self.dataArr = @[@"实名认证",@"绑定QQ账号",@"设置密码",@"绑定手机号",@"绑定邮箱"];
//  //  self.rightArr = @[@"未实名",@"未绑定",@"修改密码",@"未绑定",@"未绑定"];
//
//}
//
////发送网络请求
//- (void)sendNetworkRequest {
//
//
//        NSString *userID = [HWLocallyStoredData getLoginUserID];
//        NSString *tStr = [NSString stringWithFormat:@"%ld",[WMUtil getTimeSp]];
//        NSString *sign = [NSString stringWithFormat:@"%@%@%@",userID,tStr,@"fsd213ewdsadqwe2121213edsad"];
//        NSString *signMD5 = [WMUtil md5HexDigest:sign];
//
//
//
//
//
//        NSDictionary *parametes = @{
//                                    @"ct" :  @"app",
//                                    @"ac" : @"anquan",
//                                    @"ios" : @"1",
//                                    @"uid" :userID,
//                                    @"t" :tStr,
//                                    @"sign": signMD5
//                                    };
//
//
//
//        //[MBProgressHUD show:@"查询用户信息..."];
//
//
//        [HWWebUtils doGetWithParameters:parametes progress:nil success:^(id response) {
//
//
//            NSString *codeStr =  [NSString stringWithFormat:@"%@",response[@"code"]];
//         //   [MBProgressHUD hideHUD];
//
//
//            if ([codeStr intValue] == 1) {
//
//                  self.dataMuArr = [HWAccountSecurityModel mj_objectArrayWithKeyValuesArray:response[@"data"][@"nav"]];
//                  self.fenshuLabel.text = [NSString stringWithFormat:@"%@",response[@"data"][@"grade"]];
//               //   [MBProgressHUD  showError:@"查询用户信息成功"];
//
//                self.emailStr = response[@"data"][@"email"];
//                self.phoneStr = response[@"data"][@"phone"];
//
//
//
//
//
//            } else {
//
//                 [MBProgressHUD  showError:@"查询用户信息失败"];
//
//            }
//
//            [self.mainaTableVie reloadData];
//
//            NSLog(@"%@",response);
//
//
//        } failure:^(NSString *error) {
//
//            [MBProgressHUD  showError:@"查询用户信息失败"];
//
//
//
//
//        }];
//
//
//
//
//
//
//}
//
//
//
//
//
//
//
//
//- (void)setupUI {
//
//
//    self.view.backgroundColor = [UIColor whiteColor];
//    self.navigationItem.title = @"账户安全";
//    [self.view addSubview:self.mainaTableVie];
//
//    self.headerView = [[UIView alloc]initWithFrame:CGRectMake(0, 0, kScreenW, 159)];
//    self.headerView.backgroundColor = [UIColor whiteColor];
//    self.mainaTableVie.tableHeaderView =self.headerView;
//
//    [self addHeadVer];
//
//
//
//
//}
//// 添加HederView
//- (void)addHeadVer {
//
//    UIImageView *imageView = [[UIImageView alloc]initWithFrame:CGRectMake(0, 0, kScreenW, 159)];
//  //   imageView.image = [UIImage imageNamed:@"safe_Account_bg"];
//    imageView.backgroundColor =QCchunseshensetupian;
//
//    [self.headerView addSubview:imageView];
//
//    UIImageView  *zhuaquanimage =  [[UIImageView alloc]initWithFrame:CGRectMake((kScreenW-116)/2, 21, 116, 116)];
//    zhuaquanimage.image = [UIImage imageNamed:@"p_safe_cquan"];
//    [self.headerView addSubview:zhuaquanimage];
//
//     self.fenshuLabel = [[UILabel alloc]initWithFrame:CGRectMake((116-40)/2, 39, 40, 30)];
//     self.fenshuLabel.font = [UIFont systemFontOfSize:29];
//     self.fenshuLabel.textColor = RGB(255, 255, 255);
//     self.fenshuLabel.textAlignment =  NSTextAlignmentCenter;
//    self.fenshuLabel.text = @"98";
//  //  self.fenshuLabel.backgroundColor = [UIColor redColor];
//     [zhuaquanimage addSubview:  self.fenshuLabel];
//
//
//    self.zhanghuaanqunLabel = [[UILabel alloc]initWithFrame:CGRectMake(0, self.fenshuLabel.bottom+5, 116, 12)];
//    self.zhanghuaanqunLabel.font = [UIFont systemFontOfSize:10];
//    self.zhanghuaanqunLabel.textColor = RGB(255, 255, 255);
//    self.zhanghuaanqunLabel.textAlignment =  NSTextAlignmentCenter;
//    self.zhanghuaanqunLabel.text = @"账户安全评分";
//  //  self.zhanghuaanqunLabel.backgroundColor = [UIColor redColor];
//    [zhuaquanimage addSubview:  self.zhanghuaanqunLabel];
//
//
//    self.pointsLabel = [[UILabel alloc]initWithFrame:CGRectMake(self.fenshuLabel.right-5, 35, 10, 10)];
//    self.pointsLabel.font = [UIFont systemFontOfSize:10];
//    self.pointsLabel.textColor = RGB(255, 255, 255);
//    self.pointsLabel.textAlignment =  NSTextAlignmentCenter;
//    self.pointsLabel.text = @"分";
//     //  self.zhanghuaanqunLabel.backgroundColor = [UIColor redColor];
//    [zhuaquanimage addSubview:self.pointsLabel];
//
//
//
//
//}
//
//
//
//- (NSInteger)tableView:(UITableView *)tableView numberOfRowsInSection:(NSInteger)section {
//
//    return self.dataMuArr.count;
//
//
//}
//
//
//- (UITableViewCell *)tableView:(UITableView *)tableView cellForRowAtIndexPath:(NSIndexPath *)indexPath {
//
//    static NSString *cellID = @"cellID";
//
//    HWAccountSecurityCell *cell = [tableView dequeueReusableCellWithIdentifier:cellID];
//    if (!cell) {
//        cell = [[NSBundle mainBundle]loadNibNamed:@"HWAccountSecurityCell" owner:nil options:nil].lastObject;
//
//    }
//    cell.backgroundColor = [UIColor whiteColor];
//    cell.selectionStyle  = UITableViewCellSelectionStyleNone;
//
//    HWAccountSecurityModel *mdel = self.dataMuArr[indexPath.row];
//
//    cell.nameLabel.text = mdel.name;
//    cell.rightLabel.text = mdel.status;
//
//    return  cell;
//
//}
//
//
//- (CGFloat)tableView:(UITableView *)tableView heightForRowAtIndexPath:(NSIndexPath *)indexPath {
//
//    return  44;
//
//}
//
//- (void)tableView:(UITableView *)tableView didSelectRowAtIndexPath:(NSIndexPath *)indexPath {
//
//
//
//      HWAccountSecurityModel *mdel = self.dataMuArr[indexPath.row];
//
//    if ([mdel.type isEqualToString:@"0"]) {
//
//          if ([mdel.status isEqualToString:@"未认证"]) {
//
//                    HWRealNameAuthenticationController *authentication = [[HWRealNameAuthenticationController alloc]init];
//                    [self.navigationController pushViewController:authentication animated:YES];
//
//                } else {
//
//
//
//                }
//
//
//    } else if ([mdel.type isEqualToString:@"3"]) {
//
//                if ([mdel.status isEqualToString:@"未绑定"]) {
//
//                    HWAssociatedPhoneViewController *associated = [[HWAssociatedPhoneViewController alloc]init];
//                    [self.navigationController pushViewController:associated animated:YES];
//
//
//
//                } else {
//
//                    HWMobilePhoneDianhHuaViewController *mobil = [[HWMobilePhoneDianhHuaViewController alloc]init];
//                    mobil.phoneStr = self.phoneStr;
//
//                    [self.navigationController pushViewController:mobil animated:YES];
//
//
//
//
//                }
//
//
//
//    } else if ([mdel.type isEqualToString:@"4"]) {
//
//
//                if ([mdel.status isEqualToString:@"未绑定"]) {
//
//                   HWGuanLianEmailViewController *youxiang = [[HWGuanLianEmailViewController alloc]init];
//                   [self.navigationController pushViewController:youxiang animated:YES];
//
//
//                } else {
//
//                    HWXiuGaiEmailViewController *XiuGaiEmail = [[HWXiuGaiEmailViewController alloc]init];
//                    XiuGaiEmail.emailStr = self.emailStr;
//
//                    [self.navigationController pushViewController:XiuGaiEmail animated:YES];
//
//
//
//
//
//
//                }
//
//
//
//
//
//
//    }else if ([mdel.type isEqualToString:@"2"]) {
//
//
//                HWXiuGaiMimaJiemianViewController  *gaiMimaJiemian = [[HWXiuGaiMimaJiemianViewController alloc]init];
//                [self.navigationController pushViewController:gaiMimaJiemian animated:YES];
//
//
//
//
//    }
//
//
//
////     if (indexPath.row == 0) {
////
////
////
////      //  return;
////        if ([mdel.status isEqualToString:@"未认证"]) {
////
////            HWRealNameAuthenticationController *authentication = [[HWRealNameAuthenticationController alloc]init];
////            [self.navigationController pushViewController:authentication animated:YES];
////
////        } else {
////
////
////
////        }
////
////
////
////
////    } else if (indexPath.row == 1) {
////
////
//////        HWVerificationViewController  *verifica = [[HWVerificationViewController alloc]init];
//////        [self.navigationController pushViewController:verifica animated:YES];
////
////        HWXiuGaiMimaJiemianViewController  *gaiMimaJiemian = [[HWXiuGaiMimaJiemianViewController alloc]init];
////        [self.navigationController pushViewController:gaiMimaJiemian animated:YES];
////
////       // HWVerificationViewController
////
////
////    } else if(indexPath.row == 2) {
////
////
////        if ([mdel.status isEqualToString:@"未绑定"]) {
////
////            HWAssociatedPhoneViewController *associated = [[HWAssociatedPhoneViewController alloc]init];
////            [self.navigationController pushViewController:associated animated:YES];
////
////
////
////        } else {
////
////            HWMobilePhoneDianhHuaViewController *mobil = [[HWMobilePhoneDianhHuaViewController alloc]init];
////            mobil.phoneStr = self.phoneStr;
////
////            [self.navigationController pushViewController:mobil animated:YES];
////
////
////
////
////        }
////
////
////
////
////    } else if (indexPath.row == 3) {
////
//////        HWXiuGaiEmailViewController *xiugaiEmail = [[HWXiuGaiEmailViewController alloc]init];
//////        [self.navigationController pushViewController:xiugaiEmail animated:YES];
////
////        if ([mdel.status isEqualToString:@"未绑定"]) {
////
////           HWGuanLianEmailViewController *youxiang = [[HWGuanLianEmailViewController alloc]init];
////           [self.navigationController pushViewController:youxiang animated:YES];
////
////
////        } else {
////
////            HWXiuGaiEmailViewController *XiuGaiEmail = [[HWXiuGaiEmailViewController alloc]init];
////            XiuGaiEmail.emailStr = self.emailStr;
////
////            [self.navigationController pushViewController:XiuGaiEmail animated:YES];
////
////
////
////
////
////
////        }
////
////    }
//
//
//
//
//
//
//
//
//
//}
//
//@end



